﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WPF_Adorner.Adorners;
using Adorner1 = WPF_Adorner.Adorners.Adorner1;

namespace WPF_Adorner
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            this.Loaded += MainWindow_Loaded;

            btn.Click += Btn_Click;
            btn2.Click += Btn_Click;
        }

        private void Btn_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("你触发我了,我是大按钮");
        }

        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            var adornerLayer = AdornerLayer.GetAdornerLayer(btn);
            var adornerLayer2 = AdornerLayer.GetAdornerLayer(btn2);

            adornerLayer.Add(new Adorner1(btn));
            adornerLayer2.Add(new Adorner2(btn2));
        }
    }
}
